package com.ziyun.erp.modules.storeMaterialIn.service.impl;

import com.utility.New;
import com.ziyun.erp.modules.storeMaterialInDetail.entity.StoreMaterialInDetailEntity;
import com.ziyun.erp.modules.storeMaterialInDetail.service.StoreMaterialInDetailService;
import io.renren.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import com.ziyun.erp.modules.storeMaterialIn.dao.StoreMaterialInDao;
import com.ziyun.erp.modules.storeMaterialIn.entity.StoreMaterialInEntity;
import com.ziyun.erp.modules.storeMaterialIn.service.StoreMaterialInService;


@Service("storeMaterialInService")
public class StoreMaterialInServiceImpl extends ServiceImpl<StoreMaterialInDao, StoreMaterialInEntity> implements StoreMaterialInService {

    @Autowired
    private StoreMaterialInDetailService storeMaterialInDetailService;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<StoreMaterialInEntity> page = this.selectPage(
                new Query<StoreMaterialInEntity>(params).getPage(),
                new EntityWrapper<StoreMaterialInEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 根据采购单号获得入库详细信息
     * @param applyNo
     * @return
     */
    @Override
    public R getStoreMaterialInByApplyNo(String applyNo) {
        List<StoreMaterialInEntity> result = this.baseMapper.selectStoreMaterialInAndDetailByApplyNo(applyNo);
        return R.ok().put("storeMaterialInAndDetailList",result);
    }

}
